#include "qhexanalysis.h"
#include "ui_qhexanalysis.h"

Protocol *createDefaultProtocol(){
    QString name = QString("default protocol");
    Protocol *proto = new Protocol(NULL, -1, name);
    return proto;
}

QHexAnalysis::QHexAnalysis(QWidget *parent, Protocol *protocol) :
    QWidget(parent),
    ui(new Ui::QHexAnalysis)
{
    ui->setupUi(this);
    setProtocol(protocol);
}

QHexAnalysis::~QHexAnalysis()
{
    delete ui;
}
Protocol *QHexAnalysis::protocol() const
{
    return m_protocol;
}

void QHexAnalysis::setProtocol(Protocol *protocol)
{
    if(protocol)
        m_protocol = protocol;
    else
        m_protocol = m_defaultProtocol;
}

void QHexAnalysis::initDefaultProtocol()
{
    QString name("default protocol");
    m_defaultProtocol = new Protocol(NULL, -1, name);
}

